/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package card.notifications;

import card.entries.Charge;
import frmwrk.core.AbstractNotification;
import frmwrk.core.Account;
import frmwrk.core.Entry;

/**
 *
 * @author kgergis
 */
public class PersonalNotification extends AbstractNotification {

    private static PersonalNotification notification = null;

    private PersonalNotification() {
    }

    @Override
    public boolean isEntryNotified(Account acc, Entry entry) {
        boolean returnResult = false;
        if (entry instanceof Charge) {
            if (entry.getAmount() > 500) {
                returnResult = true;
            }
        } else {
            if (entry.getAmount() > 400 || acc.getBalance() < 0) {
                returnResult = true;
            }
        }
        return returnResult;
    }

    public static PersonalNotification getInstance() {
        if (notification == null) {
            notification = new PersonalNotification();
        }
        return notification;
    }
}
